[pull] master from DataDog:master#519
Merged
Merged
Conversation
* postgres: surface integration and DBM setup issues via `agent diagnose` Add explicit pre-flight diagnostics for the Postgres integration so `datadog-agent diagnose` flags missing prerequisites (connection, version, pg_monitor, pg_stat_activity, SPL, pg_stat_statements, datadog schema, USAGE grants, explain function) with actionable remediation text. DBM probes are gated on the relevant subfeatures (query_metrics / query_samples / query_activity), use cascade-skipping to avoid nonsensical downstream FAILs, and -- when database_autodiscovery is enabled -- run per-database for every step the docs require in each monitored database. Config validation also surfaces here. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Fix postgres diagnose runtime parity * postgres: fix explain_function with trailing parens and add config_validation diagnostic metadata Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * postgres: probe connectivity to each autodiscovered database in agent diagnose Per-database probing was gated behind dbm+query_samples, so CONNECT failures on autodiscovered databases went unreported when DBM was disabled or when only query_metrics/query_activity was enabled. Restructure _run so the per-DB loop runs whenever autodiscovery is on, with DBM-specific schema and explain-function probes layered inside. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * postgres: drop redundant 23433.fixed changelog The 23433.added entry already broadly covers the diagnose feature in this PR; the fixed entry was duplicative. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Fix Postgres diagnose query sample database probing * postgres: tighten 23433.added changelog wording Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * postgres: dedupe and parametrize test_diagnose Collapse redundant tests subsumed by cascade-skip cases, parametrize the GUC warnings, subfeature gating, unqualified explain function, connection failure, and autodiscovery connectivity tests, and add small helpers (_run, _patch_per_db, _override, _dbm_check, _assert_all_succeed) to drop ~30 boilerplate blocks. 56 → 46 test functions, 1356 → 1141 lines, same 59-case run after parametrization. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * postgres: probe pg_monitor and SELECT on pg_stat_database in agent diagnose Run the pg_monitor membership check unconditionally (it's the baseline grant for relations, activity, and statements) and add a probe that runs the actual SELECT on pg_stat_database, since deadlock/conflict/connection metrics depend on it on every run. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Address Postgres diagnose review feedback --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…patibility (#23593) * Fix quotes in SQL query for TABLE_TYPE Reference: #23590 Use single quotes Description The SQL_TABLES query in mysql/datadog_checks/mysql/queries.py uses double quotes for the string literal "BASE TABLE": When sql_mode includes ANSI_QUOTES, MySQL interprets "BASE TABLE" as an identifier (column name) rather than a string literal, causing: ``` SQL_TABLES = """\ SELECT table_name as `name`, engine as `engine`, row_format as `row_format`, create_time as `create_time` FROM information_schema.TABLES WHERE TABLE_SCHEMA = %s AND TABLE_TYPE="BASE TABLE" """ ``` When sql_mode includes ANSI_QUOTES, MySQL interprets "BASE TABLE" as an identifier (column name) rather than a string literal, causing: > pymysql.err.OperationalError: (1054, "Unknown column 'BASE TABLE' in 'where clause'") Fix Replace double quotes with single quotes: > WHERE TABLE_SCHEMA = %s AND TABLE_TYPE='BASE TABLE' Environment Agent version: 7.77.3 Aurora MySQL 8.0 with ANSI_QUOTES in sql_mode Feature: collect_schemas: enabled: true Stack trace > mysql:ef67b735b4a65475 | (tracking.py:84) | operation _get_tables error File "databases_data.py", line 312, in _get_tables self._cursor_run(cursor, query=SQL_TABLES, params=db_name) File "databases_data.py", line 156, in _cursor_run cursor.execute(query, params) pymysql.err.OperationalError: (1054, "Unknown column 'BASE TABLE' in 'where clause'") * Fix SQL_TABLES query for ANSI_QUOTES compatibility - add changelog entry * Update mysql/changelog.d/23593.fixed Co-authored-by: Eric Weaver <eweaver755@gmail.com> --------- Co-authored-by: Eric Weaver <eweaver755@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )